/**
 * 
 */
package lelouet.datacenter.simulation.events;

import lelouet.datacenter.simulation.Event;
import lelouet.datacenter.simulation.vms.AVM;

/**
 * When a {@link AVM} is about to change its state, it throws a notification,
 * explaining what has changed.<br />
 * The event producing the notification will happen at the end of the slot time
 * of the notification :<br />
 * If we are at time 0 and a notification happens at time 5, then we can
 * actually make the vm work untill slot time 5(that is, 6 slot times), then
 * handle the notification thrown, and then work again till the next
 * notification is thrown
 * 
 * @author lelouet
 */
public abstract class AEvent implements Event {

	public AEvent(long time) {
		this.time = time;
	}

	/**
	 * the slot time the VM knows this notification happens after. e.g., if the
	 * event happens between slot time 5 and slot time 6, then the value is 5
	 */
	private final long time;

	@Override
	public long getTime() {
		return time;
	}

	protected EventStates state = EventStates.STATEMENT;

	@Override
	public EventStates getState() {
		return state;
	}

	public void setState(EventStates state) {
		this.state = state;
	}

}
